package cate.game.event.championrace;

import cate.game.event.GameEventListener;
import cate.game.pvp.championrace.GameChampionRaceManager;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ChampionRaceTimerEventListener implements GameEventListener<ChampionRaceTimerEvent> {

    @Override
    public void onEvent(ChampionRaceTimerEvent timerEvent) {
        log.info("收到了事件 {}", timerEvent);
        GameChampionRaceManager.TimerEventHandler handler = timerEvent.getGameBody().pvp.championRace.getEventHandler();
        switch (timerEvent.getEventType()) {
            case OPEN:
                handler.onOpenEvent(timerEvent.getOpenEvent());
                break;
            case RANK_SETTLE:
                handler.onRankSettleEvent(timerEvent.getRankSettleEvent());
                break;
            case INVITATION:
                handler.onInvitationEvent(timerEvent.getInvitationEvent());
                break;
//            case TRIAL_GROUP:
//                handler.onTrialGroupEvent(timerEvent.getTrialGroupEvent());
//                break;
            case TRIAL:
                handler.onTrialEvent(timerEvent.getTrialEvent());
                break;
            case KO:
                handler.onKoEvent(timerEvent.getKoEvent());
                break;
//            case KO_GROUP:
//                handler.onKoGroupEvent(timerEvent.getKoGroupEvent());
//                break;
            case FINAL:
                handler.onFinalEvent(timerEvent.getFinalEvent());
                break;
//            case FINAL_GROUP:
//                handler.onFinalGroupEvent(timerEvent.getFinalGroupEvent());
//                break;
            case RANK_SWITCH:
                handler.onRankSwitchEvent(timerEvent.getRankSwitchEvent());
                break;
            case SHOW:
                handler.onShowEvent(timerEvent.getShowEvent());
                break;
            case REST:
                handler.onRestEvent(timerEvent.getRestEvent());
                break;
            default:
                break;
        }
    }
}
